package com.esun.common.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ：Ocean
 * @date ：Created in 2021/12/30 15:56
 * @description：返回单个结果
 * @modified By：
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;

    public static final Integer SUCCESS = new Integer(1);

    public static final Integer FAILED = new Integer(-1);

    public static final Integer WARING = new Integer(0);


    /**
     * 执行成功，返回结果
     * @param data
     */
    public Result(T data){
        this.code = SUCCESS;
        this.data = data;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}